new Vue({
    el: '#app',
    data: {
        total: 0,
        pageIndex: 1,
        pageSize: 10,
        pageCon: 1,
        msg: '',
        prizesList: [],
        formData: {},
        SERVER_HOST: SERVER_HOST,
        imgpath: '',
        showModel: 'none'
    },
    mounted () {
        this.load();
    },
    methods: {
        load () {

        },
        query () {
            if (!this.formData.name) {
                alert('请输入会员名称');
                return;
            }
            if (!this.formData.work) {
                alert('请输入单位名称');
                return;
            }
            this.formData['page'] = this.pageIndex;
            this.formData['size'] = this.pageSize;
            getAjax().post('/busine/prizes/list', toFormData(this.formData)).then(res => {
                if (res.data.data) {
                    this.prizesList = res.data.data.list;
                    this.total = res.data.data.total;
                    this.pageCon = Math.ceil(this.total / this.pageSize);
                    this.prizesList.forEach(item => {
                        item.createtime = getDate(item.createtime);
                    })
                }
            });
        },
        showImg (imgpath) {
            this.imgpath = imgpath;
            var modal = document.getElementById('modal');
            modal.style.display = 'block';
        },
        closeModel () {
            var modal = document.getElementById('modal');
            modal.style.display = 'none';
        },
        pageSelect (pageIndex) {
            if (pageIndex < 1 || pageIndex > this.pageCon) return;
            this.pageIndex = pageIndex;
            this.query();
        }
    }
});
